package com.user.springbootproject.controller;

import com.persons.springbootproject.entity.User;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/
@RestController
public class UserController {

    @GetMapping("/user")
    public Object info() {
        User user = new User(1L, "VIP");
        user.setAge(24);
        user.setTitle("VIP用户");
        user.setWork("VIP");
        return user;
    }

    @GetMapping("/userList")
    public Object userList() {
        List<User> userList = new ArrayList<>(2);
        for (Long i = 0L; i < 3L; i++) {
            User user = new user(i, "VIP+" + i);
            user.setAge(24);
            user.setTitle(i + "VIP");
            user.setWork("VIP" + i + "加");
            userList.add(user);
        }
        return userList;
    }
}
